Problems in connecting to postgreSQL using PHP
Problems in connecting to postgreSQL using PHP
am 12.03.2007 05:25:17 von Kitty Yuen
------=_Part_28883_5127022.1173673517836
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
I am trying to connect my postgreSQL with PHP in localhost. I have start up
the server with -i flag (i.e. postmaster -D /usr/local/pgsql/data -i &) and
edit the pg_hba.conf. However, I still cannot connect with the database.
But, when I tried to remote access the database through SSH and I can
connect with it.
Would you please offer any suggestions or solutions?
Many thanks,
Kitty3A
------=_Part_28883_5127022.1173673517836
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
I am trying to connect my postgreSQL with PHP in localhost. I have start up the server with -i flag (i.e. postmaster -D /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still cannot connect with the database. But, when I tried to remote access the database through SSH and I can connect with it.
Would you please offer any suggestions or solutions?
Many thanks,
Kitty3A
------=_Part_28883_5127022.1173673517836--
Re: Problems in connecting to postgreSQL using PHP
am 12.03.2007 13:35:45 von Matthew Terenzio
Could you provide any PHP errors or the pg_hba.conf ?
On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> Hi,
> =A0
> I am trying to connect my postgreSQL with PHP in localhost. I have=20
> start up the server with -i flag (i.e. postmaster -D=20
> /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still=20
> cannot connect with the database. But, when I tried to remote access=20
> the database through SSH and I can connect with it.
> =A0
> Would you please offer any suggestions or solutions?
> =A0
> Many=A0thanks,
> Kitty3A=A0
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Re: Problems in connecting to postgreSQL using PHP
am 12.03.2007 14:19:28 von Thomas Schindler
--Apple-Mail-23--22643105
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=ISO-8859-1;
delsp=yes;
format=flowed
how do i get off this list?
On Mar 12, 2007, at 12:35 PM, Matthew Terenzio wrote:
> Could you provide any PHP errors or the pg_hba.conf ?
>
> On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
>
>> Hi,
>>
>> I am trying to connect my postgreSQL with PHP in localhost. I have
>> start up the server with -i flag (i.e. postmaster -D /usr/local/=20
>> pgsql/data -i &) and edit the pg_hba.conf. However, I still cannot
>> connect with the database. But, when I tried to remote access the
>> database through SSH and I can connect with it.
>>
>> Would you please offer any suggestions or solutions?
>>
>> Many thanks,
>> Kitty3A
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
--=20
Thomas Schindler . Geschäftsführer
hundertelf GmbH . HRB 52839
Philippstraße 6 . 50823 Köln
fon +49 (0)221 - 5897566
cel +49 (0)162 - 9034568
fax +49 (0)221 - 35569618
thomas.schindler@hundertelf.com
www.hundertelf.com
--Apple-Mail-23--22643105
Content-Transfer-Encoding: base64
Content-Type: text/directory;
x-unix-mode=0644;
x-mac-hide-extension=yes;
name=Thomas Schindler.vcf
Content-Disposition: attachment;
filename="Thomas Schindler.vcf"
AEIARQBHAEkATgA6AFYAQwBBAFIARAANAAoAVgBFAFIAUwBJAE8ATgA6ADMA
LgAwAA0ACgBOADoAUwBjAGgAaQBuAGQAbABlAHIAOwBUAGgAbwBtAGEAcwA7
ADsAOwANAAoARgBOADoAVABoAG8AbQBhAHMAIABTAGMAaABpAG4AZABsAGUA
cgANAAoATwBSAEcAOgBoAHUAbgBkAGUAcgB0AGUAbABmACAARwBtAGIASAA7
AA0ACgBFAE0AQQBJAEwAOwB0AHkAcABlAD0ASQBOAFQARQBSAE4ARQBUADsA
dAB5AHAAZQA9AFcATwBSAEsAOwB0AHkAcABlAD0AcAByAGUAZgA6AHQAaABv
AG0AYQBzAC4AcwBjAGgAaQBuAGQAbABlAHIAQABoAHUAbgBkAGUAcgB0AGUA
bABmAC4AYwBvAG0ADQAKAFQARQBMADsAdAB5AHAAZQA9AFcATwBSAEsAOgAw
ADAANAA5AC4AMgAyADEALgA1ADgAOQA3ADUANgA2AA0ACgBUAEUATAA7AHQA
eQBwAGUAPQBDAEUATABMADsAdAB5AHAAZQA9AHAAcgBlAGYAOgAwADAANAA5
AC4AMQA2ADIAIAA5ADAAMwA0ADUANgA4AA0ACgBUAEUATAA7AHQAeQBwAGUA
PQBXAE8AUgBLADsAdAB5AHAAZQA9AEYAQQBYADoAMAAwADQAOQAuADIAMgAx
AC4AMwA1ADUANgA5ADYAMQA4AA0ACgBpAHQAZQBtADEALgBBAEQAUgA7AHQA
eQBwAGUAPQBXAE8AUgBLADsAdAB5AHAAZQA9AHAAcgBlAGYAOgA7ADsAUABo
AGkAbABpAHAAcABzAHQAcgBhAN8AZQAgADYAOwBDAG8AbABvAGcAbgBlADsA
OwA1ADAAOAAyADMAOwBHAGUAcgBtAGEAbgB5AA0ACgBpAHQAZQBtADEALgBY
AC0AQQBCAEEARABSADoAZABlAA0ACgBpAHQAZQBtADIALgBYAC0AQQBCAFIA
RQBMAEEAVABFAEQATgBBAE0ARQBTADsAdAB5AHAAZQA9AHAAcgBlAGYAOgBo
AHQAdABwAFwAOgAvAC8AdwB3AHcALgBoAHUAbgBkAGUAcgB0AGUAbABmAC4A
YwBvAG0ADQAKAGkAdABlAG0AMgAuAFgALQBBAEIATABhAGIAZQBsADoAdwBl
AGIAcwBpAHQAZQANAAoAWAAtAEEAQgBVAEkARAA6ADMARABCAEMAMQA0AEYA
NgAtADgAMQBGADIALQAxADEARAA5AC0AQQBGAEUAOQAtADAAMAAxADEAMgA0
ADMANgA3ADIAQQAyAFwAOgBBAEIAUABlAHIAcwBvAG4ADQAKAEUATgBEADoA
VgBDAEEAUgBEAA0ACg==
--Apple-Mail-23--22643105
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--Apple-Mail-23--22643105
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
--Apple-Mail-23--22643105--
Re: Problems in connecting to postgreSQL using PHP
am 12.03.2007 14:37:37 von valentinorfila
------=_Part_309_32254814.1173706657141
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi!!! I'm Venezuelan and I don't know how to speak english very well, so
excuse me if i make a mistake.
About the connection: Did you do your script by yourself?, or copied a
functional one?
As Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
Here is my connection script, it is completly good check it out to see if
you have anything wrong
/*---------------*/
$servidor =3D "localhost";
$base =3D "databasename"; //change it
$usuario =3D "postgresuser"; //change it
$password =3D "postgresuser"; //change it
pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
password=3D$password");
?>
That's all what I can do for now
2007/3/12, Matthew Terenzio :
>
> Could you provide any PHP errors or the pg_hba.conf ?
>
> On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
>
> > Hi,
> >
> > I am trying to connect my postgreSQL with PHP in localhost. I have
> > start up the server with -i flag (i.e. postmaster -D
> > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
> > cannot connect with the database. But, when I tried to remote access
> > the database through SSH and I can connect with it.
> >
> > Would you please offer any suggestions or solutions?
> >
> > Manythanks,
> > Kitty3A
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
--=20
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
E-mail: valentinorfila@gmail.com
valentinorfila@hotmail.com
josevalentinorfila@yahoo.com
Messenger: valentinorfila@hotmail.com
Skype: valentinorfila
valentinorfila@gmail.com
************************************************************ ***************
------=_Part_309_32254814.1173706657141
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi!!! I'm Venezuelan and I don't know how to speak english very wel=
l, so excuse me if i make a mistake.
About the connection: Did you d=
o your script by yourself?, or copied a functional one?
As
=3D"_user_ts@schindlermedia.com" style=3D"color: rgb(91, 16, 148);">
Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
r>
Here is my connection script, it is completly good check it out to se=
e if you have anything wrong
<? /*---------------*/
&nbs=
p; $servidor =3D "localhost";
$base =3D "databasename"; //change i=
t
$usuario =3D "postgresuser"; //chan=
ge it
$password =3D "postgresuser"; /=
/change it
pg_pconnect("h=
ost=3D$servidor dbname=3D$base user=3D$usuario password=3D$password");=
=20
?>
That's all what I can do for now
<=
br>2007/3/12, Matthew Terenzio <
=3D"mailto:matt@jobsforge.com">matt@jobsforge.com>:
e class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204);=
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could you provide any PHP errors or the pg_hba.conf ?
On Mar 12, 200=
7, at 12:25 AM, Kitty Yuen wrote:
> Hi,
>
> I am try=
ing to connect my postgreSQL with PHP in localhost. I have
> start up=
the server with -i flag (
i.e. postmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_=
hba.conf. However, I still
> cannot connect with the database. But, w=
hen I tried to remote access
> the database through SSH and I can con=
nect with it.
>
> Would you please offer any suggestions or solutions?
&=
gt;
> Manythanks,
> Kitty3A
-----------------------=
----(end of broadcast)---------------------------
TIP 2: Don't '=
kill -9' the postmaster
--
*******************=
********************************************************
Ministerio de P=
lanificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venezuela
=
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9=
fonos: Celular: (0416) 4131418
E-mail:
ila@gmail.com">valentinorfila@gmail.com
&nbs=
p;
om">
valentinorfila@hotmail.com
 =
; joseval=
entinorfila@yahoo.com
Messenger:
a@hotmail.com">valentinorfila@hotmail.com
Skype: valentinorfila
&n=
bsp; valentinorfila@gmail=
..com
************************************************************ ***=
************
------=_Part_309_32254814.1173706657141--
Re: Problems in connecting to postgreSQL using PHP
am 12.03.2007 14:41:22 von valentinorfila
------=_Part_346_12666678.1173706882724
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
here is the script again
/*---------------*/
$servidor =3D "localhost";
$base =3D "databasename"; //change it
$usuario =3D "postgresuser"; //change it
$password =3D "postgresuserpassword"; //change it
pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
password=3D$password");
?>
2007/3/12, Valent=EDn Orfila :
>
> Hi!!! I'm Venezuelan and I don't know how to speak english very well, so
> excuse me if i make a mistake.
>
> About the connection: Did you do your script by yourself?, or copied a
> functional one?
>
> As Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
>
> Here is my connection script, it is completly good check it out to see if
> you have anything wrong
>
> /*---------------*/
> $servidor =3D "localhost";
> $base =3D "databasename"; //change it
> $usuario =3D "postgresuser"; //change it
> $password =3D "postgresuser"; //change it
>
> pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
> password=3D$password");
>
> ?>
>
> That's all what I can do for now
>
> 2007/3/12, Matthew Terenzio :
> >
> > Could you provide any PHP errors or the pg_hba.conf ?
> >
> > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> >
> > > Hi,
> > >
> > > I am trying to connect my postgreSQL with PHP in localhost. I have
> > > start up the server with -i flag ( i.e. postmaster -D
> > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I stil=
l
> > > cannot connect with the database. But, when I tried to remote access
> > > the database through SSH and I can connect with it.
> > >
> > > Would you please offer any suggestions or solutions?
> > >
> > > Manythanks,
> > > Kitty3A
> >
> >
> > ---------------------------(end of broadcast)--------------------------=
-
> > TIP 2: Don't 'kill -9' the postmaster
> >
>
>
>
> --
>
> ************************************************************ *************=
**
> Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana =
de
> Venezuela
> Direcci=F3n de Planes de Personal
>
> Jos=E9 Valent=EDn Orfila Brice=F1o
> Programador II
>
> Tel=E9fonos: Celular: (0416) 4131418
>
> E-mail: valentinorfila@gmail.com
> valentinorfila@hotmail.com
> josevalentinorfila@yahoo.com
>
> Messenger: valentinorfila@hotmail.com
>
> Skype: valentinorfila
> valentinorfila@gmail.com
> ************************************************************ *************=
**
>
--=20
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
E-mail: valentinorfila@gmail.com
valentinorfila@hotmail.com
josevalentinorfila@yahoo.com
Messenger: valentinorfila@hotmail.com
Skype: valentinorfila
valentinorfila@gmail.com
************************************************************ ***************
------=_Part_346_12666678.1173706882724
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
here is the script again
<? /*---------------*/
&n=
bsp; $servidor =3D "localhost";
$base =3D "databasename"; //change i=
t
$usuario =3D "postgresuser"; //chan=
ge it
$password =3D "postgresuserpassword&=
quot;; //change it
pg_pconnect=
("host=3D$servidor dbname=3D$base user=3D$usuario password=3D$password=
");=20
?>
2007/3/1=
2, Valent=EDn Orfila <valent=
inorfila@gmail.com>:
=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; p=
adding-left: 1ex;">
Hi!!! I'm Venezuelan and I don't know how to speak english very wel=
l, so excuse me if i make a mistake.
About the connection: Did you d=
o your script by yourself?, or copied a functional one?
As
le=3D"color: rgb(91, 16, 148);">
Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
r>
Here is my connection script, it is completly good check it out to se=
e if you have anything wrong
<? /*---------------*/
&nbs=
p; $servidor =3D "localhost";
$base =3D "databasename"; //change i=
t
$usuario =3D "postgresuser"; //chan=
ge it
$password =3D "postgresuser"; /=
/change it
pg_pconnect("h=
ost=3D$servidor dbname=3D$base user=3D$usuario password=3D$password");=
=20
?>
That's all what I can do for now
<=
br>
2007/3/12, Matthew Terenzio <
=3D"mailto:matt@jobsforge.com" target=3D"_blank" onclick=3D"return top.js.O=
penExtLink(window,event,this)">
matt@jobsforge.com>:
c01adc_1">
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could you provide any PHP errors or the pg_hba.conf ?
On Mar 12, 200=
7, at 12:25 AM, Kitty Yuen wrote:
> Hi,
>
> I am try=
ing to connect my postgreSQL with PHP in localhost. I have
> start up=
the server with -i flag (
i.e. postmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_=
hba.conf. However, I still
> cannot connect with the database. But, w=
hen I tried to remote access
> the database through SSH and I can con=
nect with it.
>
> Would you please offer any suggestions or solutions?
&=
gt;
> Manythanks,
> Kitty3A
-----------------------=
----(end of broadcast)---------------------------
TIP 2: Don't '=
kill -9' the postmaster
--
******=
************************************************************ *********
Mi=
nisterio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de V=
enezuela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9=
fonos: Celular: (0416) 4131418
E-mail:
ila@gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(windo=
w,event,this)">
valentinorfila@gmail.com
&=
nbsp;
blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila@hotmail.com
 =
;
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">joseva=
lentinorfila@yahoo.com
Messenger:
la@hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wind=
ow,event,this)">
valentinorfila@hotmail.com
Skype: valentinorfila
&n=
bsp;
click=3D"return top.js.OpenExtLink(window,event,this)">valentinorfila@gmail=
..com
************************************************************ ***=
************
--
***********************=
****************************************************
Ministerio de Plani=
ficaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venezuela
Dire=
cci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9=
fonos: Celular: (0416) 4131418
E-mail:
ila@gmail.com">valentinorfila@gmail.com
&nbs=
p;
om">
valentinorfila@hotmail.com
 =
; joseval=
entinorfila@yahoo.com
Messenger:
a@hotmail.com">valentinorfila@hotmail.com
Skype: valentinorfila
&n=
bsp; valentinorfila@gmail=
..com
************************************************************ ***=
************
------=_Part_346_12666678.1173706882724--
Re: Problems in connecting to postgreSQL using PHP
am 13.03.2007 00:09:20 von dmagick
Thomas Schindler wrote:
> how do i get off this list?
Find where you subscribed and choose the unsubscribe option?
Click the unsubscribe link that appears randomly in the footers?
Or even follow the links in the email headers included with every email.
List-Unsubscribe:
--
Postgresql & php tutorials
http://www.designmagick.com/
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Re: Problems in connecting to postgreSQL using PHP
am 13.03.2007 03:27:13 von Kitty Yuen
------=_Part_18150_5808283.1173752833101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Here are my error messages from PHP:
[Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning:
pg_connect()
[]: Unable to connect
to PostgreSQL server: could not connect to server: Permission denied\n\tIs
the server running locally and accepting\n\tconnections on Unix domain
socket "/tmp/.s.PGSQL.5432"? in /var/www/html/try.php on line 3
[Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning:
pg_last_error()
[]: No PostgreSQL
link opened yet in /var/www/html/try.php on line 4
PHP Code:
// Connecting, selecting database
$dbconn = pg_connect("dbname=test user=postgres")
or die('Could not connect: ' . pg_last_error());
// Performing SQL query
$query = 'SELECT * FROM haha';
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
// Printing results in HTML
echo "
\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
echo "\t\n";
foreach ($line as $col_value) {
echo "\t\t$col_value | \n";
}
echo "\t
\n";
}
echo "
\n";
// Free resultset
pg_free_result($result);
// Closing connection
pg_close($dbconn);
*pg_hba.cof*
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
*postgresql.conf*
#----------------------------------------------------------- ----------------
# CONNECTIONS AND AUTHENTICATION
#----------------------------------------------------------- ----------------
# - Connection Settings -
listen_addresses = 'localhost' # what IP address(es) to listen
on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
port = 5432
max_connections = 100
# note: increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
superuser_reserved_connections = 2
unix_socket_directory = ''
unix_socket_group = ''
unix_socket_permissions = 0777 # octal
bonjour_name = '' # defaults to the computer name
Thanks a lot,
Kitty3A
On 3/12/07, Matthew Terenzio wrote:
>
> Could you provide any PHP errors or the pg_hba.conf ?
>
> On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
>
> > Hi,
> >
> > I am trying to connect my postgreSQL with PHP in localhost. I have
> > start up the server with -i flag (i.e. postmaster -D
> > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
> > cannot connect with the database. But, when I tried to remote access
> > the database through SSH and I can connect with it.
> >
> > Would you please offer any suggestions or solutions?
> >
> > Manythanks,
> > Kitty3A
>
>
------=_Part_18150_5808283.1173752833101
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Here are my error messages from PHP:
[Mon Mar 12 16:01:26 2007] [error] [client ] PHP Warning:
pg_connect() [<a href='function.pg-connect'>function.pg-connect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Permission denied\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/tmp/.s.PGSQL.5432"? in /var/www/html/try.php on line 3
[Mon Mar 12 16:01:26 2007] [error] [client ] PHP Warning:
pg_last_error() [<a href='function.pg-last-error'>function.pg-last-error</a>]: No PostgreSQL link opened yet in /var/www/html/try.php on line 4
PHP Code:
<?php
// Connecting, selecting database
$dbconn = pg_connect("dbname=test user=postgres")
or die('Could not connect: ' . pg_last_error());
// Performing SQL query
$query = 'SELECT * FROM haha';
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
// Printing results in HTML
echo "<table>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
pg_free_result($result);
// Closing connection
pg_close($dbconn);
pg_hba.cof
# TYPE DATABASE USER
CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all
trust
# IPv4 local connections:
host all all
trust
# IPv6 local connections:
host all all
::1/128 trust
postgresql.conf
#----------------------------------------------------------- ----------------
# CONNECTIONS AND AUTHENTICATION
#----------------------------------------------------------- ----------------
# - Connection Settings -
listen_addresses = 'localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
port = 5432
max_connections = 100
# note: increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
superuser_reserved_connections = 2
unix_socket_directory = ''
unix_socket_group = ''
unix_socket_permissions = 0777 # octal
bonjour_name = '' # defaults to the computer name
Thanks a lot,
Kitty3A
On 3/12/07, Matthew Terenzio <> wrote:
Could you provide any PHP errors or the pg_hba.conf ?
On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> Hi,
>
> I am trying to connect my postgreSQL with PHP in localhost. I have
> start up the server with -i flag (i.e. postmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
> cannot connect with the database. But, when I tried to remote access
> the database through SSH and I can connect with it.
>
> Would you please offer any suggestions or solutions?
>
> Manythanks,
> Kitty3A
------=_Part_18150_5808283.1173752833101--
Re: Problems in connecting to postgreSQL using PHP
am 14.03.2007 02:26:47 von Kitty Yuen
------=_Part_39759_4138752.1173835607267
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Dear Valent=EDn,
I think I have already enabled the extension and found the extension in my
pgsql.ini file in php.d folder. However, I still cannot connect to the
database. I guess I have something to be config in the PostgreSQL. Do you
have any ideas?
Kitty3a
On 3/13/07, Valent=EDn Orfila wrote:
>
> OK. Now you have to activate the library to connect PHP to PostgreSQL,
> this is in the php.ini file. In Windows 2000 it is in the following
> folders: C:\WINNT and in the PHP installation folder, in my case:
> C:\AppServ\php. Once you find this file you have to discomment this
> extension: extension=3Dphp_pgsql.dll, to do that you are going to erase t=
he
> ";" at the beggining of the line.
>
> Look for this file (php.ini) in your O.S. and configured it. If you are
> using Linux I guess it is in the etc/profile/php.config directory, but I0=
m
> not sure.
>
> I'm attaching you my file:
>
>
> 2007/3/12, Kitty Yuen :
> >
> > Here are my error messages from PHP:
> >
> >
> > [Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning: pg=
_connect()
> > []: Unable to
> > connect to PostgreSQL server: could not connect to server: Permission
> > denied\n\tIs the server running locally and accepting\n\tconnections on=
Unix
> > domain socket "/tmp/.s.PGSQL.5432"? in /var/www/html/try.php =
on
> > line 3
> >
> > [Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning: pg=
_last_error()
> > []: No
> > PostgreSQL link opened yet in /var/www/html/try.php on line 4
> >
> > PHP Code:
> >
> >
> >
> >
> > // Connecting, selecting database
> >
> > $dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres")
> >
> > or die('Could not connect: ' . pg_last_error());
> >
> >
> >
> > // Performing SQL query
> >
> > $query =3D 'SELECT * FROM haha';
> >
> > $result =3D pg_query($query) or die('Query failed: ' . pg_last_error())=
;
> >
> >
> >
> > // Printing results in HTML
> >
> > echo "\n";
> >
> > while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {
> >
> > echo "\t\n";
> >
> > foreach ($line as $col_value) {
> >
> > echo "\t\t$col_value | \n";
> >
> > }
> >
> > echo "\t
\n";
> >
> > }
> >
> > echo "
\n";
> >
> >
> >
> > // Free resultset
> >
> > pg_free_result($result);
> >
> >
> >
> > // Closing connection
> >
> > pg_close($dbconn);
> >
> >
> >
> > *pg_hba.cof*
> >
> > # TYPE DATABASE USER CIDR-ADDRESS METHOD
> >
> >
> >
> > # "local" is for Unix domain socket connections only
> >
> > local all all trust
> >
> >
> >
> > # IPv4 local connections:
> >
> > host all all 127.0.0.1/32 trust
> >
> > # IPv6 local connections:
> >
> > host all all ::1/128 trust
> >
> > *postgresql.conf*
> >
> >
> >
> > #----------------------------------------------------------- -----------=
-----
> >
> > # CONNECTIONS AND AUTHENTICATION
> >
> >
> > #----------------------------------------------------------- -----------=
-----
> >
> >
> >
> > # - Connection Settings -
> >
> >
> >
> > listen_addresses =3D 'localhost' # what IP address(es) to
> > listen on;
> >
> > # comma-separated list of
> > addresses;
> >
> > # defaults to 'localhost', '*' =
=3D
> > all
> >
> > port =3D 5432
> >
> > max_connections =3D 100
> >
> > # note: increasing max_connections costs ~400 bytes of shared memory pe=
r
> >
> >
> > # connection slot, plus lock space (see max_locks_per_transaction). Yo=
u
> >
> > # might also need to raise shared_buffers to support more connections.
> >
> > superuser_reserved_connections =3D 2
> >
> > unix_socket_directory =3D ''
> >
> > unix_socket_group =3D ''
> >
> > unix_socket_permissions =3D 0777 # octal
> > bonjour_name =3D '' # defaults to the computer name
> >
> > Thanks a lot,
> > Kitty3A
> >
> >
> >
> >
> >
> >
> > On 3/12/07, Matthew Terenzio wrote:
> > >
> > > Could you provide any PHP errors or the pg_hba.conf ?
> > >
> > > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to connect my postgreSQL with PHP in localhost. I have
> > > > start up the server with -i flag (i.e. postmaster -D
> > > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I
> > > still
> > > > cannot connect with the database. But, when I tried to remote acces=
s
> > > > the database through SSH and I can connect with it.
> > > >
> > > > Would you please offer any suggestions or solutions?
> > > >
> > > > Manythanks,
> > > > Kitty3A
> > >
> > >
> >
>
>
> --
>
> ************************************************************ *************=
**
> Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana =
de
> Venezuela
> Direcci=F3n de Planes de Personal
>
> Jos=E9 Valent=EDn Orfila Brice=F1o
> Programador II
>
> Tel=E9fonos: Celular: (0416) 4131418
>
> E-mail: valentinorfila@gmail.com
> valentinorfila@hotmail.com
> josevalentinorfila@yahoo.com
>
> Messenger: valentinorfila@hotmail.com
>
> Skype: valentinorfila
> valentinorfila@gmail.com
> ************************************************************ *************=
**
>
>
>
------=_Part_39759_4138752.1173835607267
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Dear Valent=EDn,<=
br>
I think I have already enabled =
the extension and found the extension in my pgsql.ini file in php.d folder.=
However, I still cannot connect to the database. I guess I have something =
to be config in the PostgreSQL. Do you have any ideas?
Kitty3a
O=
n 3/13/07, Valent=EDn Orfila <
=3D"mailto:valentinorfila@gmail.com">valentinorfila@gmail.co m> wrote=
:
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">OK. Now you have =
to activate the library to connect PHP to PostgreSQL, this is in the php.in=
i
file. In Windows 2000 it is in the following folders: C:\WINNT and in the =
PHP installation folder, in my case: C:\AppServ\php. Once you find this fil=
e you have to discomment this extension: extension=3Dphp_pgsql.dll, to do t=
hat you are going to erase the ";" at the beggining of the line.
Look for this file (php.ini) in your O.S. and configured it. If you=
are using Linux I guess it is in the etc/profile/php.config directory, but=
I0m not sure.
I'm attaching you my file:
2007/3/12, Kitty Yuen <
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">kitty3a@gmai=
l.com>:
ockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204=
, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here are my error messages from PHP:
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">
127.0.0.1] PHP Warning:
pg_connect() [<a href=3D'function.pg-connect'>f=
unction.pg-connect</a>]: Unable to connect to PostgreSQL server: coul=
d not connect to server: Permission denied\n\tIs the server running locally=
and accepting\n\tconnections on Unix domain socket "/tmp/.s.PGSQL=
..5432"? in /var/www/html/try.php on line 3
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">
127.0.0.1] PHP Warning:
pg_last_error() [<a href=3D'function.pg-last-error'=
;>function.pg-last-error</a>]: No PostgreSQL link opened yet in /v=
ar/www/html/try.php on line 4
PHP Code:
New Roman"><?php
New Roman">// Connecting, selecting database
New Roman">$dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres"=
)
New Roman"> or die('Could not connect: ' .=
pg_last_error());
New Roman">
New Roman">// Performing SQL query
New Roman">$query =3D 'SELECT * FROM haha';
New Roman">$result =3D pg_query($query) or die('Query failed: ' . p=
g_last_error());
New Roman">
New Roman">// Printing results in HTML
New Roman">echo "<table>\n";
New Roman">while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {=
font>
New Roman"> echo "\t<tr>\n";
>
New Roman"> foreach ($line as $col_value) {=
New Roman"> echo "\t\=
t<td>$col_value</td>\n";
New Roman"> }
New Roman"> echo "\t</tr>\n";
t>
New Roman">}
New Roman">echo "</table>\n";
New Roman">
New Roman">// Free resultset
New Roman">pg_free_result($result);
New Roman">
New Roman">// Closing connection
New Roman">pg_close($dbconn);
New Roman">
New Roman">pg_hba.cof
=3D"EN-US">
New Roman"># TYPE DATABASE
n>USER
CIDR-ADDRESS &=
nbsp; METHOD=
New Roman">
New Roman"># "local" is for Unix domain socket connections only=
font>
New Roman">local all =
all
&nb=
sp; =
trust
New Roman">
New Roman"># IPv4 local connections:
New Roman">host all &=
nbsp; all
27.0.0.1/32" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,=
event,this)">127.0.0.1/32 &nbs=
p; trust
New Roman"># IPv6 local connections:
New Roman">host all &=
nbsp; all
::1/128 =
&nb=
sp; trust
postgresql.conf
New Roman">#---------------------------------------------------- -----------=
------------
New Roman"># CONNECTIONS AND AUTHENTICATION
New Roman">#---------------------------------------------------- -----------=
------------
New Roman">
New Roman"># - Connection Settings -
New Roman">
New Roman">listen_addresses =3D 'localhost' =
# what IP add=
ress(es) to listen on;=20
New Roman"> &nbs=
p; &=
nbsp; &nbs=
p; # comma-separated list of addresses;
t>
New Roman"> &nbs=
p; &=
nbsp; &nbs=
p; # defaults to 'localhost', '*=
' =3D all
New Roman">port =3D 5432
New Roman">max_connections =3D 100
New Roman"># note: increasing max_connections costs ~400 bytes of shared me=
mory per
New Roman"># connection slot, plus lock space (see max_locks_per_transactio=
n). You
New Roman"># might also need to raise shared_buffers to support more connec=
tions.
New Roman">superuser_reserved_connections =3D 2
New Roman">unix_socket_directory =3D ''
New Roman">unix_socket_group =3D ''
New Roman">unix_socket_permissions =3D 0777 &n=
bsp; # octal<=
/span>
s New Roman">bonjour_name =3D ''  =
; &n=
bsp; # defaults to the computer name
>
Thanks a lot,
Kitty3A
On 3/12/07, =
Matthew Terenzio <
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">matt@jobsfor=
ge.com
> wrote:
204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Could you provide=
any PHP errors or the pg_hba.conf ?
On Mar 12, 2007, at 12:25 AM, K=
itty Yuen wrote:
> Hi,
>
> I am trying to connect my postgreSQL with=
PHP in localhost. I have
> start up the server with -i flag (i.e. po=
stmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_hba.con=
f. However, I still
> cannot connect with the database. But, when I tried to remote acce=
ss
> the database through SSH and I can connect with it.
>
=
> Would you please offer any suggestions or solutions?
>
> Manythanks,
> Kitty3A
an class=3D"e" id=3D"q_1114b7061633b0ed_3">
--
*********************=
******************************************************
Ministerio de Pla=
nificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venezuela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=
=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
=
E-mail:
ck=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila@gmail.com
lto:valentinorfila@hotmail.com" target=3D"_blank" onclick=3D"return top.js.=
OpenExtLink(window,event,this)">valentinorfila@hotmail.com
&nb=
sp;
alentinorfila@yahoo.com" target=3D"_blank" onclick=3D"return top.js.OpenExt=
Link(window,event,this)">
josevalentinorfila@yahoo.com
Messenger:
inorfila@hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLin=
k(window,event,this)">
valentinorfila@hotmail.com
Skype: valentinorfila
=
orfila@gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wi=
ndow,event,this)">valentinorfila@gmail.com
*************************=
**************************************************
------=_Part_39759_4138752.1173835607267--
Re: Problems in connecting to postgreSQL using PHP
am 14.03.2007 18:59:12 von valentinorfila
------=_Part_33402_18509013.1173895152489
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I already told you all I thought, but...
Below is the local config in my pg_hba and i just see you have one line mor=
e
than me, do you use Unix? if not, so erase that line and try again
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
localhost all all ::1/128 trust
2007/3/13, Kitty Yuen :
>
> Dear Valent=EDn,
>
> I think I have already enabled the extension and found the extension in m=
y
> pgsql.ini file in php.d folder. However, I still cannot connect to the
> database. I guess I have something to be config in the PostgreSQL. Do you
> have any ideas?
>
>
> Kitty3a
>
> On 3/13/07, Valent=EDn Orfila wrote:
> >
> > OK. Now you have to activate the library to connect PHP to PostgreSQL,
> > this is in the php.ini file. In Windows 2000 it is in the following
> > folders: C:\WINNT and in the PHP installation folder, in my case:
> > C:\AppServ\php. Once you find this file you have to discomment this
> > extension: extension=3Dphp_pgsql.dll, to do that you are going to erase=
the
> > ";" at the beggining of the line.
> >
> > Look for this file (php.ini) in your O.S. and configured it. If you are
> > using Linux I guess it is in the etc/profile/php.config directory, but =
I0m
> > not sure.
> >
> > I'm attaching you my file:
> >
> >
> > 2007/3/12, Kitty Yuen :
> > >
> > > Here are my error messages from PHP:
> > >
> > >
> > > [Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning: =
pg_connect()
> > > []: Unable to
> > > connect to PostgreSQL server: could not connect to server: Permission
> > > denied\n\tIs the server running locally and accepting\n\tconnections =
on Unix
> > > domain socket "/tmp/.s.PGSQL.5432"? in /var/www/html/try.ph=
p on
> > > line 3
> > >
> > > [Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning: =
pg_last_error()
> > > []: No
> > > PostgreSQL link opened yet in /var/www/html/try.php on line 4
> > >
> > > PHP Code:
> > >
> > >
> > >
> > >
> > > // Connecting, selecting database
> > >
> > > $dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres")
> > >
> > > or die('Could not connect: ' . pg_last_error());
> > >
> > >
> > >
> > > // Performing SQL query
> > >
> > > $query =3D 'SELECT * FROM haha';
> > >
> > > $result =3D pg_query($query) or die('Query failed: ' . pg_last_error(=
));
> > >
> > >
> > >
> > > // Printing results in HTML
> > >
> > > echo "\n";
> > >
> > > while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {
> > >
> > > echo "\t\n";
> > >
> > > foreach ($line as $col_value) {
> > >
> > > echo "\t\t$col_value | \n";
> > >
> > > }
> > >
> > > echo "\t
\n";
> > >
> > > }
> > >
> > > echo "
\n";
> > >
> > >
> > >
> > > // Free resultset
> > >
> > > pg_free_result($result);
> > >
> > >
> > >
> > > // Closing connection
> > >
> > > pg_close($dbconn);
> > >
> > >
> > >
> > > *pg_hba.cof*
> > >
> > > # TYPE DATABASE USER CIDR-ADDRESS METHOD
> > >
> > >
> > >
> > > # "local" is for Unix domain socket connections only
> > >
> > > local all all trust
> > >
> > >
> > >
> > > # IPv4 local connections:
> > >
> > > host all all 127.0.0.1/32 trust
> > >
> > > # IPv6 local connections:
> > >
> > > host all all ::1/128 trust
> > >
> > > *postgresql.conf*
> > >
> > >
> > >
> > > #----------------------------------------------------------- ---------=
-------
> > >
> > > # CONNECTIONS AND AUTHENTICATION
> > >
> > >
> > > #----------------------------------------------------------- ---------=
-------
> > >
> > >
> > >
> > > # - Connection Settings -
> > >
> > >
> > >
> > > listen_addresses =3D 'localhost' # what IP address(es) to
> > > listen on;
> > >
> > > # comma-separated list of
> > > addresses;
> > >
> > > # defaults to 'localhost', '*=
'
> > > =3D all
> > >
> > > port =3D 5432
> > >
> > > max_connections =3D 100
> > >
> > > # note: increasing max_connections costs ~400 bytes of shared memory
> > > per
> > >
> > > # connection slot, plus lock space (see max_locks_per_transaction).
> > > You
> > >
> > > # might also need to raise shared_buffers to support more connections=
..
> > >
> > > superuser_reserved_connections =3D 2
> > >
> > > unix_socket_directory =3D ''
> > >
> > > unix_socket_group =3D ''
> > >
> > > unix_socket_permissions =3D 0777 # octal
> > > bonjour_name =3D '' # defaults to the computer na=
me
> > >
> > > Thanks a lot,
> > > Kitty3A
> > >
> > >
> > >
> > >
> > >
> > >
> > > On 3/12/07, Matthew Terenzio wrote:
> > > >
> > > > Could you provide any PHP errors or the pg_hba.conf ?
> > > >
> > > > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to connect my postgreSQL with PHP in localhost. I hav=
e
> > > > > start up the server with -i flag (i.e. postmaster -D
> > > > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I
> > > > still
> > > > > cannot connect with the database. But, when I tried to remote
> > > > access
> > > > > the database through SSH and I can connect with it.
> > > > >
> > > > > Would you please offer any suggestions or solutions?
> > > > >
> > > > > Manythanks,
> > > > > Kitty3A
> > > >
> > > >
> > >
> >
> >
> > --
> >
> > ************************************************************ ***********=
****
> > Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivarian=
a de
> > Venezuela
> > Direcci=F3n de Planes de Personal
> >
> > Jos=E9 Valent=EDn Orfila Brice=F1o
> > Programador II
> >
> > Tel=E9fonos: Celular: (0416) 4131418
> >
> > E-mail: valentinorfila@gmail.com
> > valentinorfila@hotmail.com
> > josevalentinorfila@yahoo.com
> >
> > Messenger: valentinorfila@hotmail.com
> >
> > Skype: valentinorfila
> > valentinorfila@gmail.com
> > ************************************************************ ***********=
****
> >
> >
> >
>
--=20
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
E-mail: valentinorfila@gmail.com
valentinorfila@hotmail.com
josevalentinorfila@yahoo.com
Messenger: valentinorfila@hotmail.com
Skype: valentinorfila
valentinorfila@gmail.com
************************************************************ ***************
------=_Part_33402_18509013.1173895152489
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I already told you all I thought, but...
Below is the local config i=
n my pg_hba and i just see you have one line more than me, do you use Unix?=
if not, so erase that line and try again
# TYPE DATABASE =
; USER CIDR-ADDRESS&n=
bsp; METHOD
# IPv4 local connections:
host all =
all  =
; &=
nbsp; trust
# IPv6 l=
ocal connections:
localhost all  =
; all &nbs=
p; ::1/128  =
; trust
2007/3/13, Kitty Yuen =
<>:<=
blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2=
04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear
Valent=EDn,<=
br>
I think I have already enabled =
the extension and found the extension in my pgsql.ini file in php.d folder.=
However, I still cannot connect to the database. I guess I have something =
to be config in the PostgreSQL. Do you have any ideas?
Kitty3a
ec80a2bca_1">
On 3/13/07,
mail_sendername">Valent=EDn Orfila <
@gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,e=
vent,this)">
valentinorfila@gmail.com> wrote:
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">OK. Now you have =
to activate the library to connect PHP to PostgreSQL, this is in the php.in=
i
file. In Windows 2000 it is in the following folders: C:\WINNT and in the =
PHP installation folder, in my case: C:\AppServ\php. Once you find this fil=
e you have to discomment this extension: extension=3Dphp_pgsql.dll, to do t=
hat you are going to erase the ";" at the beggining of the line.
Look for this file (php.ini) in your O.S. and configured it. If you=
are using Linux I guess it is in the etc/profile/php.config directory, but=
I0m not sure.
I'm attaching you my file:
2007/3/12, Kitty Yuen <
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">kitty3a@gmai=
l.com>:
border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; paddi=
ng-left: 1ex;">
Here are my error messages from PHP:
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">
127.0.0.1] PHP Warning:
pg_connect() [<a href=3D'function.pg-connect'>f=
unction.pg-connect</a>]: Unable to connect to PostgreSQL server: coul=
d not connect to server: Permission denied\n\tIs the server running locally=
and accepting\n\tconnections on Unix domain socket "/tmp/.s.PGSQL=
..5432"? in /var/www/html/try.php on line 3
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">
127.0.0.1] PHP Warning:
pg_last_error() [<a href=3D'function.pg-last-error'=
;>function.pg-last-error</a>]: No PostgreSQL link opened yet in /v=
ar/www/html/try.php on line 4
PHP Code:
New Roman"><?php
New Roman">// Connecting, selecting database
New Roman">$dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres"=
)
New Roman"> or die('Could not connect: ' .=
pg_last_error());
New Roman">
New Roman">// Performing SQL query
New Roman">$query =3D 'SELECT * FROM haha';
New Roman">$result =3D pg_query($query) or die('Query failed: ' . p=
g_last_error());
New Roman">
New Roman">// Printing results in HTML
New Roman">echo "<table>\n";
New Roman">while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {=
font>
New Roman"> echo "\t<tr>\n";
>
New Roman"> foreach ($line as $col_value) {=
New Roman"> echo "\t\=
t<td>$col_value</td>\n";
New Roman"> }
New Roman"> echo "\t</tr>\n";
t>
New Roman">}
New Roman">echo "</table>\n";
New Roman">
New Roman">// Free resultset
New Roman">pg_free_result($result);
New Roman">
New Roman">// Closing connection
New Roman">pg_close($dbconn);
New Roman">
New Roman">pg_hba.cof
=3D"EN-US">
New Roman"># TYPE DATABASE
n>USER
CIDR-ADDRESS &=
nbsp; METHOD=
New Roman">
New Roman"># "local" is for Unix domain socket connections only=
font>
New Roman">local all =
all
&nb=
sp; =
trust
New Roman">
New Roman"># IPv4 local connections:
New Roman">host all &=
nbsp; all
27.0.0.1/32" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,=
event,this)">127.0.0.1/32 &nbs=
p; trust
New Roman"># IPv6 local connections:
New Roman">host all &=
nbsp; all
::1/128 =
&nb=
sp; trust
postgresql.conf
New Roman">#---------------------------------------------------- -----------=
------------
New Roman"># CONNECTIONS AND AUTHENTICATION
New Roman">#---------------------------------------------------- -----------=
------------
New Roman">
New Roman"># - Connection Settings -
New Roman">
New Roman">listen_addresses =3D 'localhost' =
# what IP add=
ress(es) to listen on;=20
New Roman"> &nbs=
p; &=
nbsp; &nbs=
p; # comma-separated list of addresses;
t>
New Roman"> &nbs=
p; &=
nbsp; &nbs=
p; # defaults to 'localhost', '*=
' =3D all
New Roman">port =3D 5432
New Roman">max_connections =3D 100
New Roman"># note: increasing max_connections costs ~400 bytes of shared me=
mory per
New Roman"># connection slot, plus lock space (see max_locks_per_transactio=
n). You
New Roman"># might also need to raise shared_buffers to support more connec=
tions.
New Roman">superuser_reserved_connections =3D 2
New Roman">unix_socket_directory =3D ''
New Roman">unix_socket_group =3D ''
New Roman">unix_socket_permissions =3D 0777 &n=
bsp; # octal<=
/span>
s New Roman">bonjour_name =3D ''  =
; &n=
bsp; # defaults to the computer name
>
Thanks a lot,
Kitty3A
On 3/12/07, =
Matthew Terenzio <
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">matt@jobsfor=
ge.com
> wrote:
204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Could you provide=
any PHP errors or the pg_hba.conf ?
On Mar 12, 2007, at 12:25 AM, K=
itty Yuen wrote:
> Hi,
>
> I am trying to connect my postgreSQL with=
PHP in localhost. I have
> start up the server with -i flag (i.e. po=
stmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_hba.con=
f. However, I still
> cannot connect with the database. But, when I tried to remote acce=
ss
> the database through SSH and I can connect with it.
>
=
> Would you please offer any suggestions or solutions?
>
> Manythanks,
> Kitty3A
an>
--
************************************************************ *=
**************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAbl=
ica Bolivariana de Venezuela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=
=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
=
E-mail:
ck=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila@gmail.com
lto:valentinorfila@hotmail.com" target=3D"_blank" onclick=3D"return top.js.=
OpenExtLink(window,event,this)">valentinorfila@hotmail.com
&nb=
sp;
alentinorfila@yahoo.com" target=3D"_blank" onclick=3D"return top.js.OpenExt=
Link(window,event,this)">
josevalentinorfila@yahoo.com
Messenger:
inorfila@hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLin=
k(window,event,this)">
valentinorfila@hotmail.com
Skype: valentinorfila
=
orfila@gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wi=
ndow,event,this)">valentinorfila@gmail.com
*************************=
**************************************************
--
**********=
************************************************************ *****
Minist=
erio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venez=
uela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=
=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
=
E-mail: valentinorfila@gmail.co=
m
lto:valentinorfila@hotmail.com">valentinorfila@hotmail.com
&nb=
sp;
alentinorfila@yahoo.com">josevalentinorfila@yahoo.com
Messenger:=
valentinorfila@hotmail.com
Skype: valentinorfila
=
orfila@gmail.com">valentinorfila@gmail.com
*************************=
**************************************************
------=_Part_33402_18509013.1173895152489--
Re: Problems in connecting to postgreSQL using PHP
am 14.03.2007 19:06:59 von valentinorfila
------=_Part_33554_18530516.1173895619919
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Kitty,
Try try using this function: pg_pconnect("host=3D$servidor dbname=3D$base
user=3D$usuario password=3D$password");, I mean, use the connection script =
I'm
going to paste below.
/*---------------*/
$servidor =3D "localhost";
$base =3D "databasename"; //change it
$usuario =3D "postgresuser"; //change it
$password =3D "postgresuserpassword"; //change it
pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
password=3D$password");
?>
2007/3/12, Valent=EDn Orfila :
>
> here is the script again
>
> /*---------------*/
> $servidor =3D "localhost";
> $base =3D "databasename"; //change it
> $usuario =3D "postgresuser"; //change it
> $password =3D "postgresuserpassword"; //change it
>
> pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
> password=3D$password");
>
> ?>
>
> 2007/3/12, Valent=EDn Orfila :
> >
> > Hi!!! I'm Venezuelan and I don't know how to speak english very well, s=
o
> > excuse me if i make a mistake.
> >
> > About the connection: Did you do your script by yourself?, or copied a
> > functional one?
> >
> > As Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
> >
> > Here is my connection script, it is completly good check it out to see
> > if you have anything wrong
> >
> > /*---------------*/
> > $servidor =3D "localhost";
> > $base =3D "databasename"; //change it
> > $usuario =3D "postgresuser"; //change it
> > $password =3D "postgresuser"; //change it
> >
> > pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
> > password=3D$password");
> >
> > ?>
> >
> > That's all what I can do for now
> >
> > 2007/3/12, Matthew Terenzio < matt@jobsforge.com>:
> > >
> > > Could you provide any PHP errors or the pg_hba.conf ?
> > >
> > > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to connect my postgreSQL with PHP in localhost. I have
> > > > start up the server with -i flag ( i.e. postmaster -D
> > > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I
> > > still
> > > > cannot connect with the database. But, when I tried to remote acces=
s
> > > > the database through SSH and I can connect with it.
> > > >
> > > > Would you please offer any suggestions or solutions?
> > > >
> > > > Manythanks,
> > > > Kitty3A
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 2: Don't 'kill -9' the postmaster
> > >
> >
> >
> >
> > --
> >
> > ************************************************************ ***********=
****
> > Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivarian=
a de
> > Venezuela
> > Direcci=F3n de Planes de Personal
> >
> > Jos=E9 Valent=EDn Orfila Brice=F1o
> > Programador II
> >
> > Tel=E9fonos: Celular: (0416) 4131418
> >
> > E-mail: valentinorfila@gmail.com
> > valentinorfila@hotmail.com
> > josevalentinorfila@yahoo.com
> >
> > Messenger: valentinorfila@hotmail.com
> >
> > Skype: valentinorfila
> > valentinorfila@gmail.com
> > ************************************************************ ***********=
****
> >
>
>
>
>
> --
>
> ************************************************************ *************=
**
> Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana =
de
> Venezuela
> Direcci=F3n de Planes de Personal
>
> Jos=E9 Valent=EDn Orfila Brice=F1o
> Programador II
>
> Tel=E9fonos: Celular: (0416) 4131418
>
> E-mail: valentinorfila@gmail.com
> valentinorfila@hotmail.com
> josevalentinorfila@yahoo.com
>
> Messenger: valentinorfila@hotmail.com
>
> Skype: valentinorfila
> valentinorfila@gmail.com
> ************************************************************ *************=
**
>
>
--=20
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
E-mail: valentinorfila@gmail.com
valentinorfila@hotmail.com
josevalentinorfila@yahoo.com
Messenger: valentinorfila@hotmail.com
Skype: valentinorfila
valentinorfila@gmail.com
************************************************************ ***************
------=_Part_33554_18530516.1173895619919
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Kitty,
Try try using this function: pg_pconnect(&=
quot;host=3D$servidor dbname=3D$base user=3D$usuario password=3D$password&q=
uot;);, I mean, use the connection script I'm going to paste below.
=
<? /*---------------*/
$se=
rvidor =3D "localhost";
$base =3D "databasename"; //change i=
t
$usuario =3D "postgresuser"; //chan=
ge it
$password =3D "postgresuserpa=
ssword"; //change it
 =
; pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usu=
ario password=3D$password");=20
?>
<=
div>2007/3/12, Valent=EDn Orfila <
"mailto:valentinorfila@gmail.com">valentinorfila@gmail.com>:<=
blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2=
04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
here is the script again
<? /*-----------=
----*/
$servidor =3D "localhost";
$base =3D "databasename"; //change i=
t
$usuario =3D "postgresuser"; //chan=
ge it
$password =3D "postgresuserpa=
ssword"; //change it
 =
; pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usu=
ario password=3D$password");=20
?>
2=
007/3/12, Valent=EDn Orfila <
target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)"=
>valentinorfila@gmail.com
>:
ote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204=
); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!!! I'm Venezuelan and I don't know how to speak english very wel=
l, so excuse me if i make a mistake.
About the connection: Did you d=
o your script by yourself?, or copied a functional one?
As
le=3D"color: rgb(91, 16, 148);">
Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
r>
Here is my connection script, it is completly good check it out to se=
e if you have anything wrong
<? /*---------------*/
&nbs=
p; $servidor =3D "localhost";
$base =3D "databasename"; //change i=
t
$usuario =3D "postgresuser"; //chan=
ge it
$password =3D "postgresuser"; /=
/change it
pg_pconnect("h=
ost=3D$servidor dbname=3D$base user=3D$usuario password=3D$password");=
=20
?>
That's all what I can do for now
<=
br>
2007/3/12, Matthew Terenzio <
=3D"mailto:matt@jobsforge.com" target=3D"_blank" onclick=3D"return top.js.O=
penExtLink(window,event,this)">
matt@jobsforge.com>:
te" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt=
0.8ex; padding-left: 1ex;">
Could you provide any PHP errors or the pg_hba.conf ?
On Mar 12, 200=
7, at 12:25 AM, Kitty Yuen wrote:
> Hi,
>
> I am try=
ing to connect my postgreSQL with PHP in localhost. I have
> start up=
the server with -i flag (
i.e. postmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_=
hba.conf. However, I still
> cannot connect with the database. But, w=
hen I tried to remote access
> the database through SSH and I can con=
nect with it.
>
> Would you please offer any suggestions or solutions?
&=
gt;
> Manythanks,
> Kitty3A
-----------------------=
----(end of broadcast)---------------------------
TIP 2: Don't '=
kill -9' the postmaster
--
******=
************************************************************ *********
Mi=
nisterio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de V=
enezuela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9=
fonos: Celular: (0416) 4131418
E-mail:
ila@gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(windo=
w,event,this)">
valentinorfila@gmail.com
&=
nbsp;
blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila@hotmail.com
 =
;
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">joseva=
lentinorfila@yahoo.com
Messenger:
la@hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wind=
ow,event,this)">
valentinorfila@hotmail.com
Skype: valentinorfila
&n=
bsp;
click=3D"return top.js.OpenExtLink(window,event,this)">valentinorfila@gmail=
..com
************************************************************ ***=
************
d8ee_7">
--
**********************************=
*****************************************
Ministerio de Planificaci=F3n =
y Desarrollo de la Rep=FAblica Bolivariana de Venezuela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II
Tel=E9=
fonos: Celular: (0416) 4131418
E-mail:
ila@gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(windo=
w,event,this)">
valentinorfila@gmail.com
&=
nbsp;
blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila@hotmail.com
 =
;
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">joseva=
lentinorfila@yahoo.com
Messenger:
la@hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wind=
ow,event,this)">
valentinorfila@hotmail.com
Skype: valentinorfila
&n=
bsp;
click=3D"return top.js.OpenExtLink(window,event,this)">valentinorfila@gmail=
..com
************************************************************ ***=
************
--
**********=
************************************************************ *****
Minist=
erio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venez=
uela=20
Direcci=F3n de Planes de Personal
Jos=E9 Valent=EDn Orfila Brice=
=F1o
Programador II
Tel=E9fonos: Celular: (0416) 4131418
=
E-mail: valentinorfila@gmail.co=
m
lto:valentinorfila@hotmail.com">valentinorfila@hotmail.com
&nb=
sp;
alentinorfila@yahoo.com">josevalentinorfila@yahoo.com
Messenger:=
valentinorfila@hotmail.com
Skype: valentinorfila
=
orfila@gmail.com">valentinorfila@gmail.com
*************************=
**************************************************
------=_Part_33554_18530516.1173895619919--